package com.changgou.search.pojo;

import lombok.Data;
import org.springframework.data.elasticsearch.annotations.Document;
import org.springframework.data.elasticsearch.annotations.Field;
import org.springframework.data.elasticsearch.annotations.FieldType;

import javax.persistence.Id;
import java.util.Date;
import java.util.Map;

/**
 * @author kfzhao
 * @version 1.0
 * @className SkuInfo
 * @description 索引库的映射实体类，通过在java代码中操作实体类完成对应数据的改变
 * @date 2021/12/27 1:26
 */
@Data
@Document(indexName = "skuinfo", type = "docs")
public class SkuInfo {
    //商品id，同时也是商品编号
    @Id
    @Field(index = true, store = true, type = FieldType.Keyword)
    private Long id;
    //SKU名称
    @Field(index = true, store = true, type = FieldType.Text, analyzer =
            "ik_smart")
    private String name;
    //商品价格，单位为：元
    @Field(index = true, store = true, type = FieldType.Double)
    private Long price;
    //库存数量
    @Field(index = true, store = true, type = FieldType.Integer)
    private Integer num;
    //商品图片
    @Field(index = false, store = true, type = FieldType.Text)
    private String image;
    //商品状态，1-正常，2-下架，3-删除
    @Field(index = true, store = true, type = FieldType.Keyword)
    private String status;
    //创建时间
    private Date createTime;
    //更新时间
    private Date updateTime;
    //是否默认
    @Field(index = true, store = true, type = FieldType.Keyword)
    private String isDefault;
    //SPUID
    @Field(index = true, store = true, type = FieldType.Long)
    private Long spuId;
    //类目ID
    @Field(index = true, store = true, type = FieldType.Long)
    private Long categoryId;
    //类目名称
    @Field(index = true, store = true, type = FieldType.Keyword)
    private String categoryName;
    //品牌名称
    @Field(index = true, store = true, type = FieldType.Keyword)
    private String brandName;
    //规格参数
    private String spec;

    private Map<String, Object> specMap;

}
